'    Copyright 2008 Jan Molnar <jan.molnar@abds.de>
'
'    This file is part of JCQ.

'    JCQ is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.

'    JCQ is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with JCQ. If not, see <http://www.gnu.org/licenses/>.

Public Interface IConnector
    Inherits IContextService

    Event SignInCompleted As EventHandler

    Event SignInFailed As EventHandler(Of SignInFailedEventArgs)

    Event Disconnected As EventHandler(Of DisconnectedEventArgs)

    Sub SignOut()

    Sub SignIn(ByVal credential As ICredential)
End Interface

Public Interface ICredential

End Interface

Public Interface IPasswordCredential
    Inherits ICredential

    ReadOnly Property Password() As String
End Interface

Public Class SignInFailedEventArgs
    Inherits EventArgs

    Private ReadOnly _Message As String

    Public Sub New(ByVal message As String)
        _Message = message
    End Sub

    Public ReadOnly Property Message() As String
        Get
            Return _Message
        End Get
    End Property

End Class

Public Class DisconnectedEventArgs
    Inherits EventArgs

    Private ReadOnly _Message As String
    Private ReadOnly _IsExpected As Boolean

    Public Sub New(ByVal message As String, ByVal isExpected As Boolean)
        _Message = message
        _IsExpected = isExpected
    End Sub

    Public ReadOnly Property IsExpected() As Boolean
        Get
            Return _IsExpected
        End Get
    End Property

    Public ReadOnly Property Message() As String
        Get
            Return _Message
        End Get
    End Property

End Class